Ext.define('byb.view.system.AdmOrgForm', {
    extend: "Ext.window.Window",
    alias: 'widget.admOrgForm',
    id: 'admOrgForm',
    autoShow: true,
    frame: false,
    modal: true,
    width:280,
    title: '组织信息',
    layout:"fit",
    autoScroll: false,
    initComponent: function() {
        this.callParent(arguments);
    }
    ,items:[{
    	xtype: 'form',
    	url: byb.Constant.APIRoot + "/org/save",
        border: false,
        bodyPadding: '5 5 0',
        width: 350,
        fieldDefaults: {
            flex: 1,
            margin: '10 20 0 10',
            labelStyle: 'margin-bottom: 5px',
            msgTarget: 'side',
            labelWidth: "70px"
        },
        defaultType: 'textfield',
        items: [{
        	fieldLabel:'id',
         	name:'id',
            allowBlank:true,
            hidden: true
        },{
        	fieldLabel:'组织名称',
         	name:'name',
            maxLength: 50,
            // vtype:'orgname',
            vtype:'normalWithChinese',
           	validateOnBlur:true,
           	validateOnChange:true,
            allowBlank:false
        },{
        	fieldLabel: '组织编码',
        	name:'code',
            maxLength: 60,
            allowBlank:false,
           	validateOnBlur:true,
           	validateOnChange:true,
            vtype:'normal'
        },{
            xtype: 'combobox',
            fieldLabel: '部门类型',
            name: 'subOrgnizeTypeId',
            emptyText: '--请选择班组--',
            store: Ext.create('byb.store.system.AdmDepartmentType'),
            displayField: 'name',
            valueField: 'id',
            queryMode: 'local',
            editable: false,
            listeners : {
            	select : function(combo, records, eOpts ){
            		if(!records[0].data.id){
            			combo.setValue(null);
            		}
            	}
            }
        },{
        	fieldLabel:'成立日期',
        	name:'setupDate',
        	xtype: 'datefield',
        	format: 'Y-m-d',
        	editable:false,
            allowBlank:true 
        }, {
        	fieldLabel:'联&nbsp;&nbsp;系&nbsp&nbsp;人',
        	name:'contact',
            maxLength: 20,
            allowBlank:true 
        }, {
        	fieldLabel:'联系电话',
        	name:'contactPhone',
            maxLength: 60,
            vtype:'telOrMobilePhone',
            allowBlank:true 
        }, {
            fieldLabel:'地&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;址',
        	name:'address',
            maxLength: 80,
            xtype: 'textarea',
            allowBlank:true 
        }, {
            fieldLabel:'备&nbsp;&nbsp;&nbsp;&nbsp;注',
            name:'remark',
            maxLength: 200,
            xtype: 'textarea',
            allowBlank:true 
        }],

        buttons: [{
            text: '保存',
            action: "itemSave",
            id : 'btnSaveOrg'
        },{
            text: '取消',
            handler:function(){
            	Ext.ComponentQuery.query('admOrgForm')[0].close();
            }
        }]
    }]
});